#pragma once
#include "nnse_support.h"

namespace SimpleGUI
{
	template <class T, class U> public ref class Solver : public System::Windows::Forms::Form
	{
		// Constructor and Destructor
			public: Solver(nnse::solver<T, U>^ p);
			protected: virtual ~Solver();
		// Member Variables
			private: System::ComponentModel::IContainer^  components;
			private: System::Windows::Forms::Label^  title_label;
			private: System::Windows::Forms::TextBox^  title_textBox;
			private: System::Windows::Forms::Button^  load_button;
			private: System::Windows::Forms::ToolTip^  load_toolTip;
			private: System::Windows::Forms::OpenFileDialog^  load_openFileDialog;
			private: System::Windows::Forms::Button^  save_button;
			private: System::Windows::Forms::ToolTip^  save_toolTip;
			private: System::Windows::Forms::SaveFileDialog^  save_saveFileDialog;
			private: System::Windows::Forms::Button^  train_button;
			private: System::Windows::Forms::ToolTip^  train_toolTip;
			private: System::Windows::Forms::Button^  test_button;
			private: System::Windows::Forms::ToolTip^  test_toolTip;
			private: System::Windows::Forms::Button^  prev_button;
			private: System::Windows::Forms::ToolTip^  prev_toolTip;
			private: System::Windows::Forms::Button^  next_button;
			private: System::Windows::Forms::ToolTip^  next_toolTip;
			private: System::Windows::Forms::Label^  number_of_training_examples_label;
			private: System::Windows::Forms::TextBox^  number_of_training_examples_textBox;
			private: System::Windows::Forms::Label^  number_of_testing_examples_label;		
			private: System::Windows::Forms::TextBox^  number_of_testing_examples_textBox;
			private: System::Windows::Forms::Label^  current_training_example_label;
			private: System::Windows::Forms::TextBox^  current_training_example_textBox;
			private: System::Windows::Forms::Label^  current_testing_example_label;
			private: System::Windows::Forms::TextBox^  current_testing_example_textBox;
			private: System::Windows::Forms::Label^  number_of_MLPs_label;
			private: System::Windows::Forms::TextBox^  number_of_MLPs_textBox;
			private: System::Windows::Forms::GroupBox^  view_groupBox;
			private: System::Windows::Forms::Button^  input_button;
			private: System::Windows::Forms::Button^  output_button;
			private: System::Windows::Forms::Button^  target_button;
			private: System::Windows::Forms::Button^  view_button;
			private: System::Windows::Forms::ToolTip^  view_toolTip;
			private: System::Windows::Forms::Label^  status_label;
			private: System::Windows::Forms::ProgressBar^  status_progressBar;
			private: nnse::solver<T, U>^ parent;
		// GUI Functions
			private: System::Void load_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void save_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void train_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void test_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void prev_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void next_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void input_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void output_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void target_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void view_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void form_closed(System::Object^  sender, System::Windows::Forms::FormClosedEventArgs^  e);
			public: System::Void update_form(System::String^ progress_text, unsigned int progress_min, unsigned int progress_val, unsigned int progress_max);		
#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = (gcnew System::ComponentModel::Container());
			this->title_label = (gcnew System::Windows::Forms::Label());
			this->number_of_training_examples_label = (gcnew System::Windows::Forms::Label());
			this->number_of_MLPs_label = (gcnew System::Windows::Forms::Label());
			this->title_textBox = (gcnew System::Windows::Forms::TextBox());
			this->number_of_training_examples_textBox = (gcnew System::Windows::Forms::TextBox());
			this->number_of_MLPs_textBox = (gcnew System::Windows::Forms::TextBox());
			this->view_button = (gcnew System::Windows::Forms::Button());
			this->current_training_example_label = (gcnew System::Windows::Forms::Label());
			this->current_training_example_textBox = (gcnew System::Windows::Forms::TextBox());
			this->prev_button = (gcnew System::Windows::Forms::Button());
			this->next_button = (gcnew System::Windows::Forms::Button());
			this->train_button = (gcnew System::Windows::Forms::Button());
			this->test_button = (gcnew System::Windows::Forms::Button());
			this->status_progressBar = (gcnew System::Windows::Forms::ProgressBar());
			this->status_label = (gcnew System::Windows::Forms::Label());
			this->number_of_testing_examples_textBox = (gcnew System::Windows::Forms::TextBox());
			this->number_of_testing_examples_label = (gcnew System::Windows::Forms::Label());
			this->current_testing_example_textBox = (gcnew System::Windows::Forms::TextBox());
			this->current_testing_example_label = (gcnew System::Windows::Forms::Label());
			this->save_button = (gcnew System::Windows::Forms::Button());
			this->load_button = (gcnew System::Windows::Forms::Button());
			this->load_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->save_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->train_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->test_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->prev_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->next_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->view_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->load_openFileDialog = (gcnew System::Windows::Forms::OpenFileDialog());
			this->save_saveFileDialog = (gcnew System::Windows::Forms::SaveFileDialog());
			this->view_groupBox = (gcnew System::Windows::Forms::GroupBox());
			this->input_button = (gcnew System::Windows::Forms::Button());
			this->output_button = (gcnew System::Windows::Forms::Button());
			this->target_button = (gcnew System::Windows::Forms::Button());
			this->view_groupBox->SuspendLayout();
			this->SuspendLayout();
			// 
			// title_label
			// 
			this->title_label->AutoSize = true;
			this->title_label->Location = System::Drawing::Point(12, 10);
			this->title_label->Name = L"title_label";
			this->title_label->Size = System::Drawing::Size(30, 13);
			this->title_label->TabIndex = 0;
			this->title_label->Text = L"Title:";
			// 
			// number_of_training_examples_label
			// 
			this->number_of_training_examples_label->AutoSize = true;
			this->number_of_training_examples_label->Location = System::Drawing::Point(12, 70);
			this->number_of_training_examples_label->Name = L"number_of_training_examples_label";
			this->number_of_training_examples_label->Size = System::Drawing::Size(148, 13);
			this->number_of_training_examples_label->TabIndex = 1;
			this->number_of_training_examples_label->Text = L"Number of Training Examples:";
			// 
			// number_of_MLPs_label
			// 
			this->number_of_MLPs_label->AutoSize = true;
			this->number_of_MLPs_label->Location = System::Drawing::Point(12, 202);
			this->number_of_MLPs_label->Name = L"number_of_MLPs_label";
			this->number_of_MLPs_label->Size = System::Drawing::Size(89, 13);
			this->number_of_MLPs_label->TabIndex = 4;
			this->number_of_MLPs_label->Text = L"Number of MLPs:";
			// 
			// title_textBox
			// 
			this->title_textBox->Location = System::Drawing::Point(48, 7);
			this->title_textBox->Name = L"title_textBox";
			this->title_textBox->Size = System::Drawing::Size(261, 20);
			this->title_textBox->TabIndex = 5;
			// 
			// number_of_training_examples_textBox
			// 
			this->number_of_training_examples_textBox->Location = System::Drawing::Point(161, 67);
			this->number_of_training_examples_textBox->Name = L"number_of_training_examples_textBox";
			this->number_of_training_examples_textBox->Size = System::Drawing::Size(148, 20);
			this->number_of_training_examples_textBox->TabIndex = 6;
			// 
			// number_of_MLPs_textBox
			// 
			this->number_of_MLPs_textBox->Location = System::Drawing::Point(161, 199);
			this->number_of_MLPs_textBox->Name = L"number_of_MLPs_textBox";
			this->number_of_MLPs_textBox->Size = System::Drawing::Size(148, 20);
			this->number_of_MLPs_textBox->TabIndex = 9;
			// 
			// view_button
			// 
			this->view_button->Location = System::Drawing::Point(15, 288);
			this->view_button->Name = L"view_button";
			this->view_button->Size = System::Drawing::Size(294, 23);
			this->view_button->TabIndex = 14;
			this->view_button->Text = L"View MLPs in this Solver";
			this->view_button->UseVisualStyleBackColor = true;
			this->view_button->Click += gcnew System::EventHandler(this, &Solver::view_button_Click);
			// 
			// current_training_example_label
			// 
			this->current_training_example_label->AutoSize = true;
			this->current_training_example_label->Location = System::Drawing::Point(12, 136);
			this->current_training_example_label->Name = L"current_training_example_label";
			this->current_training_example_label->Size = System::Drawing::Size(128, 13);
			this->current_training_example_label->TabIndex = 16;
			this->current_training_example_label->Text = L"Current Training Example:";
			// 
			// current_training_example_textBox
			// 
			this->current_training_example_textBox->Location = System::Drawing::Point(161, 133);
			this->current_training_example_textBox->Name = L"current_training_example_textBox";
			this->current_training_example_textBox->Size = System::Drawing::Size(148, 20);
			this->current_training_example_textBox->TabIndex = 17;
			// 
			// prev_button
			// 
			this->prev_button->Location = System::Drawing::Point(215, 34);
			this->prev_button->Name = L"prev_button";
			this->prev_button->Size = System::Drawing::Size(44, 23);
			this->prev_button->TabIndex = 18;
			this->prev_button->Text = L"Prev";
			this->prev_button->UseVisualStyleBackColor = true;
			this->prev_button->Click += gcnew System::EventHandler(this, &Solver::prev_button_Click);
			// 
			// next_button
			// 
			this->next_button->Location = System::Drawing::Point(265, 34);
			this->next_button->Name = L"next_button";
			this->next_button->Size = System::Drawing::Size(44, 23);
			this->next_button->TabIndex = 19;
			this->next_button->Text = L"Next";
			this->next_button->UseVisualStyleBackColor = true;
			this->next_button->Click += gcnew System::EventHandler(this, &Solver::next_button_Click);
			// 
			// train_button
			// 
			this->train_button->Location = System::Drawing::Point(115, 34);
			this->train_button->Name = L"train_button";
			this->train_button->Size = System::Drawing::Size(44, 23);
			this->train_button->TabIndex = 22;
			this->train_button->Text = L"Train";
			this->train_button->UseVisualStyleBackColor = true;
			this->train_button->Click += gcnew System::EventHandler(this, &Solver::train_button_Click);
			// 
			// test_button
			// 
			this->test_button->Location = System::Drawing::Point(165, 34);
			this->test_button->Name = L"test_button";
			this->test_button->Size = System::Drawing::Size(44, 23);
			this->test_button->TabIndex = 23;
			this->test_button->Text = L"Test";
			this->test_button->UseVisualStyleBackColor = true;
			this->test_button->Click += gcnew System::EventHandler(this, &Solver::test_button_Click);
			// 
			// status_progressBar
			// 
			this->status_progressBar->Location = System::Drawing::Point(15, 347);
			this->status_progressBar->Name = L"status_progressBar";
			this->status_progressBar->Size = System::Drawing::Size(294, 23);
			this->status_progressBar->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
			this->status_progressBar->TabIndex = 24;
			// 
			// status_label
			// 
			this->status_label->AutoSize = true;
			this->status_label->Location = System::Drawing::Point(19, 321);
			this->status_label->Name = L"status_label";
			this->status_label->Size = System::Drawing::Size(0, 13);
			this->status_label->TabIndex = 28;
			// 
			// number_of_testing_examples_textBox
			// 
			this->number_of_testing_examples_textBox->Location = System::Drawing::Point(161, 100);
			this->number_of_testing_examples_textBox->Name = L"number_of_testing_examples_textBox";
			this->number_of_testing_examples_textBox->Size = System::Drawing::Size(148, 20);
			this->number_of_testing_examples_textBox->TabIndex = 36;
			// 
			// number_of_testing_examples_label
			// 
			this->number_of_testing_examples_label->AutoSize = true;
			this->number_of_testing_examples_label->Location = System::Drawing::Point(12, 103);
			this->number_of_testing_examples_label->Name = L"number_of_testing_examples_label";
			this->number_of_testing_examples_label->Size = System::Drawing::Size(145, 13);
			this->number_of_testing_examples_label->TabIndex = 35;
			this->number_of_testing_examples_label->Text = L"Number of Testing Examples:";
			// 
			// current_testing_example_textBox
			// 
			this->current_testing_example_textBox->Location = System::Drawing::Point(161, 166);
			this->current_testing_example_textBox->Name = L"current_testing_example_textBox";
			this->current_testing_example_textBox->Size = System::Drawing::Size(148, 20);
			this->current_testing_example_textBox->TabIndex = 38;
			// 
			// current_testing_example_label
			// 
			this->current_testing_example_label->AutoSize = true;
			this->current_testing_example_label->Location = System::Drawing::Point(12, 169);
			this->current_testing_example_label->Name = L"current_testing_example_label";
			this->current_testing_example_label->Size = System::Drawing::Size(125, 13);
			this->current_testing_example_label->TabIndex = 37;
			this->current_testing_example_label->Text = L"Current Testing Example:";
			// 
			// save_button
			// 
			this->save_button->Location = System::Drawing::Point(65, 34);
			this->save_button->Name = L"save_button";
			this->save_button->Size = System::Drawing::Size(44, 23);
			this->save_button->TabIndex = 40;
			this->save_button->Text = L"Save";
			this->save_button->UseVisualStyleBackColor = true;
			this->save_button->Click += gcnew System::EventHandler(this, &Solver::save_button_Click);
			// 
			// load_button
			// 
			this->load_button->Location = System::Drawing::Point(15, 34);
			this->load_button->Name = L"load_button";
			this->load_button->Size = System::Drawing::Size(44, 23);
			this->load_button->TabIndex = 39;
			this->load_button->Text = L"Load";
			this->load_button->UseVisualStyleBackColor = true;
			this->load_button->Click += gcnew System::EventHandler(this, &Solver::load_button_Click);
			// 
			// view_groupBox
			// 
			this->view_groupBox->Controls->Add(this->target_button);
			this->view_groupBox->Controls->Add(this->output_button);
			this->view_groupBox->Controls->Add(this->input_button);
			this->view_groupBox->Location = System::Drawing::Point(15, 226);
			this->view_groupBox->Name = L"view_groupBox";
			this->view_groupBox->Size = System::Drawing::Size(294, 48);
			this->view_groupBox->TabIndex = 41;
			this->view_groupBox->TabStop = false;
			this->view_groupBox->Text = L"View";
			// 
			// input_button
			// 
			this->input_button->Location = System::Drawing::Point(12, 16);
			this->input_button->Name = L"input_button";
			this->input_button->Size = System::Drawing::Size(75, 23);
			this->input_button->TabIndex = 0;
			this->input_button->Text = L"Input";
			this->input_button->UseVisualStyleBackColor = true;
			this->input_button->Click += gcnew System::EventHandler(this, &Solver::input_button_Click);
			// 
			// output_button
			// 
			this->output_button->Location = System::Drawing::Point(110, 16);
			this->output_button->Name = L"output_button";
			this->output_button->Size = System::Drawing::Size(75, 23);
			this->output_button->TabIndex = 1;
			this->output_button->Text = L"Output";
			this->output_button->UseVisualStyleBackColor = true;
			this->output_button->Click += gcnew System::EventHandler(this, &Solver::output_button_Click);
			// 
			// target_button
			// 
			this->target_button->Location = System::Drawing::Point(208, 16);
			this->target_button->Name = L"target_button";
			this->target_button->Size = System::Drawing::Size(75, 23);
			this->target_button->TabIndex = 2;
			this->target_button->Text = L"Target";
			this->target_button->UseVisualStyleBackColor = true;
			this->target_button->Click += gcnew System::EventHandler(this, &Solver::target_button_Click);
			// 
			// Solver
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(325, 380);
			this->Controls->Add(this->view_groupBox);
			this->Controls->Add(this->save_button);
			this->Controls->Add(this->load_button);
			this->Controls->Add(this->current_testing_example_textBox);
			this->Controls->Add(this->current_testing_example_label);
			this->Controls->Add(this->number_of_testing_examples_textBox);
			this->Controls->Add(this->number_of_testing_examples_label);
			this->Controls->Add(this->status_label);
			this->Controls->Add(this->status_progressBar);
			this->Controls->Add(this->test_button);
			this->Controls->Add(this->train_button);
			this->Controls->Add(this->next_button);
			this->Controls->Add(this->prev_button);
			this->Controls->Add(this->current_training_example_textBox);
			this->Controls->Add(this->current_training_example_label);
			this->Controls->Add(this->view_button);
			this->Controls->Add(this->number_of_MLPs_textBox);
			this->Controls->Add(this->number_of_training_examples_textBox);
			this->Controls->Add(this->title_textBox);
			this->Controls->Add(this->number_of_MLPs_label);
			this->Controls->Add(this->number_of_training_examples_label);
			this->Controls->Add(this->title_label);
			this->Name = L"Solver";
			this->Text = L"Solver";
			this->FormClosed += gcnew System::Windows::Forms::FormClosedEventHandler(this, &Solver::form_closed);
			this->view_groupBox->ResumeLayout(false);
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	};
}
